package com.youxin.busfoundation.common.es.bean;

import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.youxin.busfoundation.bean.classify.QueryClassifyBean;
import com.youxin.busfoundation.enums.OrderType;
import com.youxin.busfoundation.utils.es.EsBasePage;
import com.youxin.foundation.utils.ArrayUtils;
import com.youxin.foundation.utils.StringUtils;

/**
 * 客户端请求线索
 * 
 * @author yingde.cao
 *
 */
public class RequestQueryLeadsBean extends EsBasePage<Object> {
	/**
	 * 查询类型,对应SystemType 0表示公司,1表示线索
	 */
	private int type=0;	
	private List<String> industry;
	
	@JsonProperty("industry_small")
	private List<String> industrySmall;
	
	@JsonProperty("order_by")
	private int orderBy=1;
	
	private String by;
	
	@JsonProperty("pre_tags")
	private String preTags;
	@JsonProperty("post_tags")
	private String postTags;
	
	/**
	 * 企业规模
	 */
	private List<Integer> scale; 
	/**
	 * 成立年限
	 */
	@JsonProperty("establish_time")
	private List<Integer> establishTime;
	/**
	 * 注册资本
	 */
	@JsonProperty("registered_capital")
	private List<Integer> registeredCapital;
	
	private String province,city;
	
	
	private List<QueryClassifyBean> classify;	

	public List<QueryClassifyBean> getClassify() {
		return classify;
	}
	
	/**
	 * 是否空的搜索请求
	 * @return
	 */
	@JsonIgnore
	public boolean isEmptySearch()
	{
		return ArrayUtils.isEmpty(industry)
				&&ArrayUtils.isEmpty(industrySmall)
				&&ArrayUtils.isEmpty(classify)
				&&ArrayUtils.isEmpty(establishTime)
				&&ArrayUtils.isEmpty(registeredCapital)
				&&ArrayUtils.isEmpty(scale)
				&&StringUtils.isNullOrEmpty(province)
				&&StringUtils.isNullOrEmpty(city)
				&&StringUtils.isNullOrEmpty(keywords)
				;
	}
	
	public String getPreTags() {
		return preTags;
	}

	public void setPreTags(String preTags) {
		this.preTags = preTags;
	}

	public String getPostTags() {
		return postTags;
	}

	public void setPostTags(String postTags) {
		this.postTags = postTags;
	}

	public void setClassify(List<QueryClassifyBean> classify) {
		this.classify = classify;
	}
	
	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}
	
	public OrderType getOrderType()
	{
		if(StringUtils.isNullOrEmpty(by)){
			return OrderType.ASC;
		}
		OrderType orderType=OrderType.nameOf(by);
		if(orderType==null)
		{
			return OrderType.ASC;
		}
		return orderType;
	}
	
	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}

	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}

	

	public int getOrderBy() {
		return orderBy;
	}

	public void setOrderBy(int orderBy) {
		this.orderBy = orderBy;
	}

	public String getBy() {
		return by;
	}

	public void setBy(String by) {
		this.by = by;
	}

	private String keywords;

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public List<Integer> getScale() {
		return scale;
	}

	public void setScale(List<Integer> scale) {
		this.scale = scale;
	}

	public List<Integer> getEstablishTime() {
		return establishTime;
	}

	public void setEstablishTime(List<Integer> establishTime) {
		this.establishTime = establishTime;
	}

	public List<Integer> getRegisteredCapital() {
		return registeredCapital;
	}

	public void setRegisteredCapital(List<Integer> registeredCapital) {
		this.registeredCapital = registeredCapital;
	}

	public List<String> getIndustry() {
		return industry;
	}

	public void setIndustry(List<String> industry) {
		this.industry = industry;
	}

	public List<String> getIndustrySmall() {
		return industrySmall;
	}

	public void setIndustrySmall(List<String> industrySmall) {
		this.industrySmall = industrySmall;
	}
	
	
	@JsonIgnore
	private List<String> filterUids;

	public List<String> getFilterUids() {
		return filterUids;
	}

	public void setFilterUids(List<String> filterUids) {
		this.filterUids = filterUids;
	}
	
	
}
